package com.shaoyu.spring.study.demo;

import com.shaoyu.spring.study.dto.BaseRequest;
import lombok.Data;

/**
 * @author : Swicky
 * @date : 2021/4/21 - 9:53 上午
 */
@Data
class DemoDtoFather extends BaseRequest {
    private String fatherName;
}

@Data
class DemoDtoSon extends DemoDtoFather{
    private String sonName;
}

@Data
class DemoCmd{
    private String name;
}

public class Main{
    public static void main(String[] args) {
        //继承方式
        BaseRequest son = new DemoDtoSon();
        son.set("fatherName","fatherNameValue");
        son.set("sonName","sonNameValue");
        DemoDtoSon son1 = (DemoDtoSon)son;
        System.out.println(son1.getFatherName());
        System.out.println(son1.getSonName());

        //代理方式
        DemoCmd demoCmd = new DemoCmd();
        BaseRequest<DemoCmd> build = BaseRequest.build(demoCmd);
        build.set("name","123456");
        String name = build.get("name");
        System.out.println(name);
        System.out.println(demoCmd.getName());
    }
}
